customproperty: Add our own query_value function
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Mar 2012 21:23:11 +0000 (23:23 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:13 +0000 (08:59 +0200)
I'm about to change the CssStyleProperty one, so better copy things
here.

gtk/gtkcsscustomproperty.c

index 7785895f8246c0ff9e282837c26d3421e5292056..9da425fe7ae7f4a9199e13b1706f9be7a8360071 100644 (file)
@@ -83,12 +83,30 @@ gtk_css_custom_property_parse_value (GtkStyleProperty *property,
   return result;
 }
 
+static void
+gtk_css_custom_property_query (GtkStyleProperty   *property,
+                               GValue             *value,
+                               GtkStyleQueryFunc   query_func,
+                               gpointer            query_data)
+{
+  GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property);
+  GtkCssValue *css_value;
+  
+  css_value = (* query_func) (_gtk_css_style_property_get_id (style), query_data);
+  if (css_value == NULL)
+    css_value =_gtk_css_style_property_get_initial_value (style);
+
+  _gtk_css_value_init_gvalue (css_value, value);
+  g_assert (GTK_CSS_CUSTOM_PROPERTY (property)->pspec->value_type == G_VALUE_TYPE (value));
+}
+
 static void
 _gtk_css_custom_property_class_init (GtkCssCustomPropertyClass *klass)
 {
   GtkStylePropertyClass *property_class = GTK_STYLE_PROPERTY_CLASS (klass);
 
   property_class->parse_value = gtk_css_custom_property_parse_value;
+  property_class->query = gtk_css_custom_property_query;
 }
 
 static GtkCssValue *